﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Student.aspx.cs" Inherits="XHCTMS.VIEW.Student" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="shortcut icon" href="/favicon.ico">
	<link rel="apple-touch-icon" href="/apple-touch-icon.png">
	<link rel="stylesheet" href="css/style.css?v=2">
	
	<!-- fluid 960 -->
	<link rel="stylesheet" type="text/css" href="css/text.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="css/layout.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="css/grid.css" media="screen" />
	<!-- superfish menu -->
	<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
	<!-- tags css -->
	<link rel="stylesheet" href="css/jquery.tagsinput.css">
	<!-- treeview css -->
	<link rel="stylesheet" href="css/jquery.treeview.css">
	<!-- dataTable css -->
	<link rel="stylesheet" href="css/demo_table_jui.css">


	<!-- fluid GS -->
	<link rel="stylesheet" type="text/css" href="css/fluid.gs.css" media="screen" />
	<!--[if lt IE 8 ]>
	<link rel="stylesheet" type="text/css" href="css/fluid.gs.lt_ie8.css" media="screen" />
	<![endif]-->

	<!-- //jqueryUI css -->
	<link type="text/css" href="css/custom-theme/jquery-ui-1.8.13.custom.css" rel="stylesheet" />
	
	<!-- //jquery -->
	<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> -->
	<script src="js/libs/jquery-1.5.1.min.js"></script>
	<script>	    !window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.5.1.min.js"%3E%3C/script%3E'))</script>
	<!-- //jqueryUI -->
	<script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
	<script type="text/javascript" src="js/jquery-fluid16.js"></script>
	<script src="js/plugins.js"></script>
	<script src="js/script.js"></script>
	
	<!-- //xoxco tags plugin https://github.com/xoxco/jQuery-Tags-Input -->
	<script src="js/jquery.tagsinput.min.js"></script>
	<link rel="stylesheet" href="css/jquery.tagsinput.css">
	
	<!--[if lt IE 7 ]>
	<script src="js/libs/dd_belatedpng.js"></script>
	<script> DD_belatedPNG.fix('img, .png_bg');</script>
	<![endif]-->
	<!-- modernizr -->
	<script src="js/libs/modernizr-1.7.min.js"></script>
	
	<!-- superfish menu and needed js for menu -->
	<script src="js/superfish.js"></script>
	<script src="js/supersubs.js"></script>
	<script src="js/hoverIntent.js"></script>

	<!-- treeview -->
	<script src="js/jquery.treeview.js"></script>
	
	<!-- dataTable -->
	<script src="js/jquery.dataTables.min.js"></script>

    <link href="css/ACE.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            $("#dialogAdd").dialog({
                autoOpen: false, width: 530, modal: true,
                buttons: {
                    "确定": function () {
                        if ($("#lblAddPrompt").html().length <= 0) {
                            $("#txtAddXHStuID").trigger("onblur");
                        }
                        if ($("#lblAddPrompt").html().length <= 0) {
                            $("#txtAddStuName").trigger("onblur");
                        }
                        if ($("#lblAddPrompt").html().length <= 0) {
                            $("#txtAddStuPersonID").trigger("onblur");
                        }
                        if ($("#lblAddPrompt").html().length <= 0) {
                            $("#btnAdd").trigger("click");
                        }

                    },
                    "取消": function () {

                        $(this).dialog("close");
                    }
                }
            });

            $("#dialogAlter").dialog({
                autoOpen: false, width: 530, modal: true,
                buttons: {
                    "修改": function () {
                        if ($("#lblAlterPrompt").html().length <= 0) {
                            $("#txtAlterXHStuID").trigger("onblur");
                        }
                        if ($("#lblAlterPrompt").html().length <= 0) {
                            $("#txtAlterStuName").trigger("onblur");
                        }
                        if ($("#lblAlterPrompt").html().length <= 0) {
                            $("#btnAlter").trigger("click");
                        }

                    },
                    "取消": function () {

                        $(this).dialog("close");
                    }
                }
            });

            $("#divSearch").click(function () {
                $("#btnSearch").trigger("click");
            });

            $("#aFirst").click(function () {

                var page = '<%=Session["page"] %>';
                if (page == 1) {
                    return false;
                }
                $("#btnAFirst").trigger("click");
            });
            $("#aPrevious").click(function () {
                var ddlpage = $("#ddlPage  option:selected").text().split('/')[0];
                if (ddlpage <= 1) {
                    return false;
                }
                $("#btnAPrevious").trigger("click");
            });
            $("#aNext").click(function () {
                var ddlpage = $("#ddlPage  option:selected").text().split('/')[0];
                var maxpage = $("#ddlPage  option:selected").text().split('/')[1];
                if (ddlpage >= maxpage) {
                    return false;
                }
                $("#btnANext").trigger("click");
            });
            $("#aLast").click(function () {
                var ddlpage = $("#ddlPage  option:selected").text().split('/')[0];
                var maxpage = $("#ddlPage  option:selected").text().split('/')[1];
                if (ddlpage == maxpage) {
                    return false;
                }
                $("#btnALast").trigger("click");
            });



            $("#alert").dialog({ autoOpen: false, modal: true });


            $("#divAdd").click(function () {
                $("#txtAddStuName").val("");
                $("#txtAddStuPersonID").val("");
                $("#txtAddXHStuID").val("");
                $("#lblAddPrompt").html("");
                $("#txtTempStuName").val("");
                $("#txtTempStuPerID").val("");
                $("#txtTempXHStuID").val("");
                $("#txtTempStuGender").val("男");
                $("#txtTempStuClassID").val($("#ddlAddStuClassName option:selected").val());

                $("#dialogAdd").dialog("open");
            });





        });

        function addtotemp(addName, tempName) {
        document.getElementById(tempName).value = document.getElementById(addName).value;

        };

        function idtodllTemp(alterName, tempName) {
            var classid = $("#" + alterName).val();
            document.getElementById(tempName).value = classid;
        };


        function Message(mess) {
            
            $("#alert > p").html(mess);
            $("#alert").dialog("open");
        };

        function selecttr(t) {

            $("#txtAlterXHStuID").val($(t).parent().parent().find("td :eq(1)").html());
            $("#txtTempXHStuID").val($(t).parent().parent().find("td :eq(1)").html());
           $("#txtAlterStuName").val($(t).parent().parent().find("td :eq(2)").html());
           $("#txtTempStuName").val($(t).parent().parent().find("td :eq(2)").html());
           $("#txtTempStuState").val('');
           var selecttext = $(t).parent().parent().find("td :eq(5)").html();
          
           
           var count = $("#ddlAlterStuClassName option").length;

           for (var i = 0; i < count; i++) {          
               if ($("#ddlAlterStuClassName ").get(0).options[i].value ==  selecttext) {
                   $("#ddlAlterStuClassName ").get(0).options[i].selected = true;
                   break;
               }
           }




           idtodllTemp("ddlAlterStuClassName", "txtTempStuClassID");
           //$("#ddlAlterStuClassName").find("option[text=" + selecttext + "]").attr("selected", true);



           $("#txtTempStuClassName").val($(t).parent().parent().find("td :eq(6)").html());

           
           //var count = $("#ddlAlterStuClassName ").size();
           $("#txtTempStuID").val($(t).parent().parent().find("td :eq(0)").html());
       

            $("#dialogAlter").dialog("open");

            
        };
        function graduation(t) {
            $("#txtTempStuID").val($(t).parent().parent().find("td :eq(0)").html());
            if (confirm("是否确定该学生毕业，毕业后将不能对其操作")) {
                $("#btnGraduation").trigger("click"); 
            } else {
               
            }
                  
        };

        function AddPrompt(Message, lblName) {
            $("#"+lblName+"").html(Message);
            if (Message = '') {
                return true;
            }
            else {
                return false;
            }
        }

        function ValidateIdCard(sId) {
            var strsid = sId.toString();
            if (strsid.length > 18) {
                return "身份证：证号过长";
            }
            var aCity = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江 ", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北 ", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏 ", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外 " }

            var iSum = 0;
            var info = "";
            //if (!/^d{17}(d|x)$/i.test(sId)) return 'Error:非法证号';
            sId = sId.replace(/x$/i, "a");
            if (aCity[parseInt(sId.substr(0, 2))] == null) return "身份证:非法地区";
            sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
            var d = new Date(sBirthday.replace(/-/g, "/"))
            if (sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate())) return "身份证:非法生日";
            for (var i = 17; i >= 0; i--) iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11)
            if (iSum % 11 != 1) return "身份证:非法证号";
            return '';
        }

    </script>
	
</head>
<body runat="server">
  <div id="outer" style="width:100%">
    <form id="form1" runat="server" >
  
    <div class="box">
						<h2>
							<a href="#" id="toggle-forms"> 学生信息管理</a>
						</h2> 
						<div class="block" id="forms">
								<fieldset>
									<legend>操作区</legend>
                                    <div style="width:750px">                                  

                                        <label id="lblXHStuID" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学号</label>
									
                                     <input id="txtXHStuID" runat="server" type="text" class="txt" />
                                                             <label id="lblStuName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名</label>
									
                                     <input id="txtStuName" runat="server"  type="text" class="txt" />
                                                             <label id="lblSubName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;专业</label>
                                        <asp:DropDownList ID="ddlSubName" runat="server" class="dropdownlist" >
                                        </asp:DropDownList>
                                        <br />
                                                             <label id="lblSubYear">专业学制</label>
                                   
                                     <asp:DropDownList ID="ddlSubYear" runat="server" class="dropdownlist" >
                                        </asp:DropDownList>
                                       <label id="lblClassName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级</label>
									
                                    <asp:DropDownList ID="ddlClassName" runat="server" class="dropdownlist" >
                                        </asp:DropDownList>
                                       <label id="lblClassTea">&nbsp;&nbsp;班主任</label>
									
                                   <asp:DropDownList ID="ddlClassTea" runat="server" class="dropdownlist" >
                                        </asp:DropDownList>

                                     <br />
                                     <br />
                                     	    <div id="divAdd" class="six column">
									      
									      	<a  id="dialog_link1" href="javascript:void(0)" class=" dialog_link ui-state-default ui-corner-some floatRight"><span class=" span-ui-icon ui-icon ui-icon-circle-plus "></span>增加</a>
									     
									    </div>
                                  
                                     

                                     

                                           <div id="divSearch" class="six column" runat="server" >
									      
									      	<a  id="A2" href="javascript:void(0)" class=" dialog_link ui-state-default ui-corner-some floatRight"><span class=" span-ui-icon ui-icon ui-icon-search "></span>查询</a>
									     
									    </div>
                                      </div>                                        
									</fieldset>
							</div>
					</div>
    
    
    <a id="topa"></a>
    <div id="divRep" class="box"  >
						<h2>
							<a href="#" id="toggle-list">学生信息</a>
						</h2>
						<div class="block" id="list" >		
                        <table style="width:100%; " cellpadding="0" cellspacing="0" border="0" >	
                         	<asp:Repeater ID="repStuInfo" runat="server">	
                            <HeaderTemplate>

                            
                                        <thead > 
                                        <tr >                                 
                                            <th align="center">
                                                <asp:Label ID="lblHxhStuID" runat="server" Text="新华学号"></asp:Label>
                                            </th>
                                            <th >
                                            <asp:Label ID="lblHStuName" runat="server" Text="姓名"></asp:Label>
                                            </th>
                                            <th >
                                            <asp:Label ID="lblHSubName" runat="server" Text="专业"></asp:Label>
                                                &nbsp;</th>
                                            <th  >
                                            <asp:Label ID="lblHSubYear"  runat="server" Text="专业学制"></asp:Label>
                                                &nbsp;</th>
                                                         <th >
                                   
                                            <asp:Label ID="lblHClassName" runat="server" Text="班级"></asp:Label>
                                                &nbsp;</th>
                                            <th >
                                            <asp:Label ID="lblHClassTea" runat="server" Text="班主任"></asp:Label>
                                                &nbsp;</th>
                                                <th style="text-align:center">
                                             <asp:Label ID="lblopera"  runat="server" Text="操作"></asp:Label>
                                                &nbsp;</th>
                                                </tr> 
                                        </thead>
                            </HeaderTemplate>
                            <ItemTemplate>
                            <tbody>
                           <tr width="100%" >
                                              <td   style="display:none">
                                             <asp:Label ID="dllblStuID" runat="server" Text='<%# Eval("student_id")%>' ></asp:Label>
                                            </td>
                                            <td width="16%">
                                                <asp:Label ID="dllblxhStuID" runat="server" Text='<%# Eval("xhstudent_id") %>' ></asp:Label>
                                            </td>
                                            <td width="12%">
                                                <asp:Label ID="dllblStuName" runat="server" Text='<%# Eval("student_name") %>' ></asp:Label>
                                            </td>
                                            <td width="18%">
                                                <asp:Label ID="dllblSubName" runat="server" Text='<%# Eval("sub_name") %>' ></asp:Label>
                                                &nbsp;</td>
                                            <td width="11%" style="text-align:center">
                                                <asp:Label ID="dllblSubYear" runat="server" Text='<%# Eval("sub_years") %>' ></asp:Label>
                                                &nbsp;</td>
                                                   <td style=" display:none">
                                                <asp:Label ID="dllblClassID" runat="server" Text='<%# Eval("class_id") %>' ></asp:Label>
                                                &nbsp;</td>
                                            <td width="15%">
                                                <asp:Label ID="dllblClassName" runat="server" Text='<%# Eval("class_name") %>' ></asp:Label>
                                                &nbsp;</td>
                                            <td width="11%">
                                                <asp:Label ID="dllblClassTea" runat="server" Text='<%# Eval("user_name") %>' ></asp:Label>
                                                &nbsp;</td>
                                                <td  style="text-align:center">  
                                                
									      
									      	<a href="javascript:void(0)" onclick="selecttr(this)"  > 修改</a>&nbsp;&nbsp;&nbsp;
									     <a href="javascript:void(0)" onclick="graduation(this)"  > 毕业</a>
									   
                                                </td>
                                        </tr>
                        
                            
                            </tbody>
                            
                            
                            </ItemTemplate>
                            <FooterTemplate>
                             <tfoot> 
                                        <tr>                                 
                                            <th >
                                                <asp:Label ID="lblFxhStuID" runat="server" Text="新华学号"></asp:Label>
                                            </th>
                                            <th >
                                            <asp:Label ID="lblFStuName" runat="server" Text="姓名"></asp:Label>
                                            </th>
                                            <th>
                                            <asp:Label ID="lblFSubName" runat="server" Text="专业"></asp:Label>
                                                &nbsp;</th>
                                            <th style="text-align:center">
                                            <asp:Label ID="lblFSubYear" runat="server" Text="专业学制"></asp:Label>
                                                &nbsp;</th>
                                            <th >
                                            <asp:Label ID="lblFClassName" runat="server" Text="班级"></asp:Label>
                                                &nbsp;</th>
                                            <th >
                                            <asp:Label ID="lblFClassTea" runat="server" Text="班主任"></asp:Label>
                                                &nbsp;</th>
                                                 <th style="text-align:center" >
                                            <asp:Label ID="lblFOpera"  runat="server" Text="操作"></asp:Label>
                                                &nbsp;</th>
                                                </tr> 
                                                
                                        </tfoot>
                             
                            </FooterTemplate>


                            
                            </asp:Repeater>               
                           
                         </table>
                     
               	   <a id="aLast" href="#" class=" dialog_link ui-state-default ui-corner-some floatRight " >尾页</a>
                                                         
			    <a id="aNext" href="#" class=" dialog_link ui-state-default ui-corner-some floatRight" >下一页</a>
									                                        
                            <asp:DropDownList ID="ddlPage"  
                                class="dialog_link ui-state-default ui-corner-some floatRight" Width="85px"  AutoPostBack="true"
                                runat="server" onselectedindexchanged="ddlPage_SelectedIndexChanged">
                            </asp:DropDownList> 
                           
				<a id="aPrevious"  href="#" class=" dialog_link ui-state-default ui-corner-some floatRight ">上一页</a>
                                          
                                         
				<a id="aFirst" href="#" class=" dialog_link ui-state-default ui-corner-some floatRight">首页</a>
                                

						


					</div>


     <div id="alert"  title ="消息">
      <p></p>
     </div>




    

      
           <div id="dialogAdd"  title="新生入学"  style="display:none"> 
              <asp:Label ID="lblAddXHStuID" runat="server" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学号</asp:Label>
         <asp:TextBox ID="txtAddXHStuID" runat="server" onblur="if($('#txtAddXHStuID').val().length<= 0){AddPrompt('请填写学号','lblAddPrompt')}else{AddPrompt('','lblAddPrompt')} ;addtotemp('txtAddXHStuID','txtTempXHStuID')"
          class="txt"></asp:TextBox>
         <asp:Label ID="lblAddStuName"  runat="server" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名</asp:Label>
         <asp:TextBox ID="txtAddStuName" onblur="if($('#txtAddStuName').val().length<= 0){AddPrompt('请填写姓名','lblAddPrompt')}else{AddPrompt('','lblAddPrompt')};addtotemp('txtAddStuName','txtTempStuName')" 
         runat="server" class="txt"></asp:TextBox>
         <asp:Label ID="lblAddStuSex" runat="server" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;性别</asp:Label>
               <asp:DropDownList ID="ddlAddStuSex" onchange="idtodllTemp('ddlAddStuSex','txtTempStuGender')" class="dropdownlist" runat="server"  >
                   <asp:ListItem Selected="True">男</asp:ListItem>
                   <asp:ListItem>女</asp:ListItem>
               </asp:DropDownList>
                <asp:Label ID="lblAddStuPersonID" runat="server" >&nbsp;&nbsp;&nbsp;身份证</asp:Label>
         <asp:TextBox ID="txtAddStuPersonID" onblur="AddPrompt(ValidateIdCard($('#txtAddStuPersonID').val()),'lblAddPrompt');addtotemp('txtAddStuPersonID','txtTempStuPerID')" runat="server" class="txt"></asp:TextBox>
              

         <asp:Label ID="lblAddStuClassName" runat="server" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级</asp:Label>
               <asp:DropDownList ID="ddlAddStuClassName" onchange="idtodllTemp('ddlAddStuClassName','txtTempStuClassID')"  class="dropdownlist" style="width:250px" runat="server">
               </asp:DropDownList>            
               <br />
               <br />
              <label id="lblAddPrompt" style="color:Red"> </label>
     </div>

        <div id="dialogAlter"  title="学员信息修改" style="display:none" > 
              <asp:Label ID="lblAlterXHStuID" runat="server" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学号</asp:Label>
         <asp:TextBox ID="txtAlterXHStuID" runat="server" onblur="if($('#txtAlterXHStuID').val().length<= 0){AddPrompt('请填写学号','lblAlterPrompt')}else{AddPrompt('','lblAlterPrompt')};addtotemp('txtAlterXHStuID','txtTempXHStuID')" class="txt"></asp:TextBox>
         <asp:Label ID="lblAlterStuName" runat="server" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名</asp:Label>
         <asp:TextBox ID="txtAlterStuName" onblur="if($('#txtAlterStuName').val().length<= 0){AddPrompt('请填写姓名','lblAlterPrompt')}else{AddPrompt('','lblAlterPrompt')};addtotemp('txtAlterStuName','txtTempStuName')" runat="server" class="txt"></asp:TextBox>
        
              
              

         <asp:Label ID="lblAlterStuClassName" runat="server" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级</asp:Label>
               <asp:DropDownList ID="ddlAlterStuClassName" onchange="idtodllTemp('ddlAlterStuClassName','txtTempStuClassID')" class="dropdownlist" runat="server">
               </asp:DropDownList>            
          <asp:Label ID="lblAlterStuFlag" runat="server" >在校状况</asp:Label>
               <asp:DropDownList ID="ddlAlterStuFlag" class="dropdownlist" onchange="idtodllTemp('ddlAlterStuFlag','txtTempStuState')" runat="server">
               <asp:ListItem Selected="True">在校</asp:ListItem>
                   <asp:ListItem>毕业</asp:ListItem>
                   <asp:ListItem>休学</asp:ListItem>
               </asp:DropDownList>     
               <br />
               <br />
              <label id="lblAlterPrompt" style="color:Red">  </label>  
     </div>





     <asp:Button ID="btnAdd" runat="server"  style=" display:none"  UseSubmitBehavior ="false" Text="Button" onclick="btnAdd_Click" />
   
    <asp:Button ID="btnSearch" runat="server"   style=" display:none"   
        onclick="btnSearch_Click" />

        <asp:Button ID="btnAlter" runat="server" style=" display:none"   UseSubmitBehavior ="false" Text="Button" 
                            onclick="btnAlter_Click"  />

 <asp:Button ID="btnAFirst" runat="server" onclick="btnAFirst_Click" style=" display:none"     />
        <asp:Button ID="btnAPrevious" runat="server" 
        onclick="btnAPrevious_Click"   style=" display:none"    />
        <asp:Button ID="btnANext" runat="server" onclick="btnANext_Click" style=" display:none"     />
   <asp:Button ID="btnALast" runat="server" onclick="btnALast_Click"     style=" display:none"      />

   <asp:Button ID="btnGraduation" runat="server" onclick="btnGraduation_Click"  style=" display:none"     />

   
        <asp:TextBox ID="txtTempXHStuID" style="display:none"  runat="server"> </asp:TextBox>
        <asp:TextBox ID="txtTempStuName" style="display:none"  runat="server">  </asp:TextBox>
        <asp:TextBox ID="txtTempStuPerID" style="display:none" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtTempStuID" style="display:none" runat="server"></asp:TextBox>
         <asp:TextBox ID="txtTempStuState" style="display:none" runat="server"></asp:TextBox>
     <asp:TextBox ID="txtTempStuGender" style="display:none" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtTempStuClassID" style="display:none" runat="server"></asp:TextBox>
        
       
    </form>

    </div>


    	
</body>
</html>
